#include <bits/stdc++.h>
#include "C.hpp"

using namespace std;

typedef long long ll;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back
#define vec vector<int>

vector<int> id;
vector<pii> ans;

vector<pii> work(int n){
	id.pb(1); 
	for(int i = 2;i <= n;i++){
		int l = 1,r = i - 1; while(l <= r){int mid = l+r>>1; if(ask(vec(id.begin(),id.begin()+mid),i)) r = mid-1;else l = mid+1;}
		id.insert(id.begin()+l-1,i);
	}reverse(id.begin(),id.end()); id.pop_back();
	vec now; now.pb(1);
	for(int t : id){
		while(ask(now,t)){
			int l = 1,r = now.size();
			while(l <= r){int mid = l+r>>1; if(ask(vec(now.begin(),now.begin()+mid),t)) r = mid-1;else l = mid+1;}
			ans.pb(pii(t,now[l-1]));now.erase(now.begin()+l-1);
		}now.pb(t);
	}for(int t : now) if(t ^ 1) ans.pb(pii(1,t)); return ans;
}
